package com.cleaningcloud.cld.service.impl.mini;

import com.cleaningcloud.cld.domain.mini.MiniExportDto;
import com.cleaningcloud.cld.mapper.CldStaffMapper;
import com.cleaningcloud.cld.mapper.mini.MiniExportMapper;
import com.cleaningcloud.cld.mapper.mini.MiniPersonnelMapper;
import com.cleaningcloud.cld.service.mini.IMiniExportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * packageName com.cleaningcloud.cld.service.impl.mini
 *
 * @author 你的名字
 * @version JDK 8
 * @className MiniExportServiceImpl
 * @date 2025-06-25
 * @description 小程序(客户端)-导出功能
 */
@Service
public class MiniExportServiceImpl implements IMiniExportService {

    @Autowired
    private MiniExportMapper miniExportMapper;

    /**
     * @Author Shaw
     * @Description 导出日报/月报图片
     * @date: 2025-06-25 15:26
     * @param: //TODO
     */
    public Map<String, Object> exportImg(MiniExportDto miniExportDto){
        Map<String, Object> map = new HashMap<String, Object>();
        if(null != miniExportDto.getSelectType()){
            String[] str = miniExportDto.getSelectType().split(",");
            for (int i = 0; i < str.length; i++) {
                if(str[i].equals("A")){
                    //统计在职人数
                    map.put("staffMap",miniExportMapper.getStaffNumberByProjectGroup(miniExportDto.getProjectId()));
                }
                if(str[i].equals("B")){
                    //统计排休人数
                    map.put("restbreakMap",miniExportMapper.getRestbreakNumberByProjectGroup(miniExportDto));
                }
                if(str[i].equals("C")) {
                    //统计出勤人数
                    map.put("attendanceMap",miniExportMapper.getAttendanceNumberByProjectGroup(miniExportDto));
                }
                if(str[i].equals("D")) {
                    //统计物资详情
                    map.put("materialMap",miniExportMapper.getMaterialNumberByType(miniExportDto));
                }
                if(str[i].equals("E")) {
                    //统计设备状态
                    map.put("assetsMap",miniExportMapper.getAssetsNumberByProject(miniExportDto));
                }
                if(str[i].equals("F")) {
                    //统计工作计划
                    map.put("workPlanMap", miniExportMapper.getWorkPlanNumberByProject(miniExportDto));
                }
                if(str[i].equals("G")) {
                    //获取例会列表
                    map.put("regularMap", miniExportMapper.getRegularListByProject(miniExportDto));
                }
                if(str[i].equals("H")) {
                    //统计临时工作安排
                    map.put("temporaryMap", miniExportMapper.getTemporaryNumberByProject(miniExportDto));
                }
                if(str[i].equals("I")) {
                    //统计客户处置
                    map.put("complaintsMap", miniExportMapper.getComplaintsNumberByProject(miniExportDto));
                }
            }
        }
        return map;
    }
}